/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package wisimconsole;

import java.awt.Component;
import javax.swing.JCheckBox;
import javax.swing.JList;
import javax.swing.ListCellRenderer;

/**
 *
 * @author brother
 */
// Handles rendering cells in the list using a check box
public class CheckListRenderer extends JCheckBox
	implements ListCellRenderer {

    @Override
    public Component getListCellRendererComponent(
	    JList list, Object value, int index,
	    boolean isSelected, boolean hasFocus) {
	
	setEnabled(list.isEnabled());
	
	setFont(list.getFont());
	setBackground(list.getBackground());
	setForeground(list.getForeground());
	if(value instanceof CheckListItem){
	    setSelected(((CheckListItem) value).isSelected());
	}
	
	setText(value.toString());
	return this;
    }
}
